package io.gitee.thinkbungee.utils.mongo;

/**
 * mongo的类型
 * https://www.runoob.com/mongodb/mongodb-operators-type.html
 *
 * @author chenyichang
 * @date 2022/3/11
 */
public enum MongoType {

    DOUBLE(1),
    VARCHAR(2),
    OBJECT(3),
    ARRAY(4),
    OBJECT_ID(7),
    BIT(8),//布尔类型
    DATE(9),
    NULL(10),
    TIMESTAMP(17),
    INT(16),
    LONG(18),
    ;


    private final int num;

    public int getNum() {
        return num;
    }

    MongoType(int num) {
        this.num = num;
    }

    public static String typeInfo(int num) {
        MongoType[] values = values();
        for (MongoType mt : values) {
            if (num == mt.num) {
                return mt.toString();
            }
        }
        return null;
    }
}

